package pojo;

import java.util.Random;
import java.util.Scanner;

public class Xclear {
    public static void main(String[] args) {
        LinearList<Integer> list = new SinglyLinkedList<>();
        for (int i = 0; i < 100; i++) {
            Random random = new Random();
            list.insert(random.nextInt(100)+1);
        }
        list.printList();
        System.out.println();
        Scanner s = new Scanner(System.in);
        Integer a = s.nextInt();
        int j = 0;
        for (int i = 0; i < 100; i++) {
            if (list.get(i) == a){
                list.remove(i);
                j++;
            }
        }

        if (j == 0) {
            System.out.println("没有找到"+a+"这个元素");
        }else{
            System.out.println("移除了"+j+"个元素");
        }
    }
}
